# coding=utf-8
# 本题为考试多行输入输出规范示例，无需提交，不计分。
import sys


def decoder(operator):
    index = 0
    my_str = []
    for i in operator:
        if i == "(":
            my_str.insert(index, "(")
            index += 1
        elif i == ")":
            my_str.insert(index, ")")
            index += 1
        elif i == "D":
            if index != 0:
                my_str.pop(index-1)
                index -= 1
        elif i == "L":
            if index != 0:
                index -= 1
        elif i == "R":
            if index != len(my_str):
                index += 1
    return "".join(my_str)


def is_valid(my_str):
    # breakpoint()
    if my_str == "" or my_str == "()":
        return True
    
    if my_str[0] == ")":
        return False
    for i in range(len(my_str)-2):
        index = len(my_str)-1 - i
        if my_str[index] == ")":
            res = is_valid(my_str[1:index]) and is_valid(my_str[index+1:])
            if res == True:
                return True
    return False

def get_wrong_score(my_str):
    left = 0
    right = 0
    for i in my_str:
        if i == "(":
            left += 1
        else:
            right += 1
    return -abs(left -right)

def get_score(my_str):
    left_max = 0
    right_max = 0
    left = 0
    right = 0
    i = 0
    # breakpoint()
    while(i < len(my_str)):
        while(i < len(my_str) and my_str[i] == "(" ):
            left += 1
            left_max = max(left_max,left)
            i += 1
        while(i < len(my_str) and my_str[i] == ")" ):
            right += 1
            right_max = max(right_max,right)
            i += 1
        left = 0
        right = 0
    depth = max(left_max,right_max)
    return depth

if __name__ == "__main__":
    # 读取第一行的n
    # n = int(sys.stdin.readline().strip())
    values = []
    for i in range(2):
        # 读取每一行
        line = sys.stdin.readline().strip()
        # 把每一行的数字分隔后转化成int列表
        value = list(map(str, line.split()))
        values.append(value)

    # res = myfunc(num_sugar, threshold, count, sugar_list)
    operator = []
    operator.extend(values[1][0])
    res = []
    for i in range(len(operator)):
        new_operator = operator[0:i+1]
        my_str = decoder(new_operator)
        validness = is_valid(my_str)
        if validness:
            score = get_score(my_str)
        else:
            score = get_wrong_score(my_str)
        res.append(score)
    # for i in range(len(res)):
    #     print(res[i]," ")
    new_str = ""
    for i in range(len(res)):
        new_str += str(res[i])
        new_str += " "
    print(new_str)
